<#include "layout/template.ftl"/>

<@htmlHead title="商品订单详情">
<style>	
	.bordered td{
		border:1px solid #dddddd;
	}
	body #printArea td{
	 	font-size:10px;
	}

</style>	

</@htmlHead>


 
<@htmlBody 'shop' 'goodsorderManage'>

	<!-- breadcrumbs begin -->
	<#include "layout/breadcrumbs.ftl">
	<@breadcrumbs '订单管理' '商品订单详情'></@breadcrumbs>
	<!-- breadcrumbs end -->

	<!-- page-content begin -->
	<div class="page-content">
			
			
			<!-- page-header begin -->
			<div class="page-header">
				<h1>
					<i class="fa fa-print"></i>&nbsp;商品订单详情
					<a href="javascript:void(0);" class="btn btn-warning pull-right print-preview">
						<i class="ace-icon fa fa-print"></i>打印订单
					</a>
				</h1>
			</div>			
			<!-- page-header end -->

			<!-- page-body begin -->
			<div class="row">	
				<div class="col-md-8 col-md-offset-2" >
						<table class="table " style="border:0px;" id="printArea"  >
								<tr>	
								    <td colspan="3" style="font-size:18px;font-weight:bolder;border:0px;"><img src="${resources}/images/logo.png"><div>
									<td colspan="3" style="font-size:25px;font-weight:bolder;border:0px;color: red;"><!-- ${corp.name} --></td>
									<td colspan="3" style="font-size:10px;font-weight:bolder;border:0px;color: red;">(客服存留)</td>
								</tr>
								<tr>	
									<td colspan="8" style="text-align:center;font-size:14px;font-weight:bolder;border:0px;"></td>
								</tr>
								<tr>	
									<td colspan="3" style="border:0px;" >订单编号:${order.orderno}</td>
									<td colspan="3" style="border:0px;" >订购时间:${order.createTime}</td>
									<td colspan="2" style="border:0px;" >客户姓名:${order.member.nickname}</td>
								</tr>
								<tr>	
									<td colspan="3"  style="border:0px;" >收货地址:${order.address}</td>
									<td colspan="3"  style="border:0px;" >联系方式:${order.telephone}</td>
									<!-- <td colspan="2"  style="border:0px;" >日期:</td> -->
								</tr>	
								<tr class="bordered">	
									<td>商品编号</td>
									<td>商品名称</td>
									<td>规格</td>
									<td>数量</td>
									<td>单价</td>
									<td>商品总额</td>
									<td>运费</td>
									<td>其他优惠</td>
									<td>订单支付金额</td>
								</tr>
				       			<#list order.orderItemList as orders>
									<tr  class="bordered">
										<td>${orders.id}</td>
										<td>${orders.goods.name}</td>
										<td></td>
										<td>${orders.amount}</td>
										<td>${orders.goods.price?string("0.00")}</td>
										<td>${orders.price?string("0.00")}</td>
										<td>0</td>
										<td>0</td>
										<td>${order.total}</td>
									</tr>
								</#list>
								
								<tr style="margin-top: 10px">
									<td colspan="8"  style="border:0px;color: red;" >注意：如需退换货，请致电热线400-660-3813</td>
								</tr>
								<!-- <tr>
									<td colspan="4"  style="border:0px;" >收货单位及经手人(盖章):</td>
									<td colspan="4"  style="border:0px;" >送货单位及经手人(盖章):</td>
								</tr> -->
						</table>
			</div>
			<!-- page-body end -->
		
	</div>		
	<!-- page-content end -->

</@htmlBody>



<@htmlBodyScript>
		
	
	<!-- 打印组件  -->
	<script src="${resources}/plugins/jquery-print/DoersGuild/jQuery.print.js" type="text/javascript" charset="utf-8"></script>
     <!--[if lt IE 9]>
        <script src="js/vendor/html5-3.6-respond-1.1.0.min.js"></script>
    <![endif]-->
    <script type="text/javascript">
        $(function() {
        	//数字金额
        	var total =parseFloat($("#totalHZ").html());
        	//汉字金额
        	var totalHZ = changeNumMoneyToChinese(total);
        	$("#totalHZ").html(totalHZ);
        	
        	//打印
        	$(".print-preview").click(function(){
        		$.print("#printArea");
        	})
			
			/*
			function print(){
				$("#printArea").print({
			 		addGlobalStyles : true,
				    stylesheet : null,
				    rejectWindow : true,
				    noPrintSelector : ".no-print",
				    iframe : true,
				    append : null,
				    prepend : null
				});
			}
			*/
        });
    </script>

	<!--金额大写转换函数-->
 	<script type="text/javascript">
		function changeNumMoneyToChinese(money){
			  var cnNums = new Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"); 
			  var cnIntRadice = new Array("", "拾", "佰", "仟"); 
			  var cnIntUnits = new Array("", "万", "亿", "兆");
			  var cnDecUnits = new Array("角", "分", "毫", "厘");
			  var cnInteger = "整"; 
			  var cnIntLast = "元";
			  var maxNum = 999999999999999.9999;
			  var IntegerNum; 
			  var DecimalNum; 
			  var ChineseStr = ""; 
			  var parts; 
			  if (money == ""){
			    return "";
			  }
			  money = parseFloat(money);
			  if (money >= maxNum) {
			    alert('超出最大处理数字');
			    return "";
			  }
			  if (money == 0) {
			    ChineseStr = cnNums[0] + cnIntLast + cnInteger;
			    return ChineseStr;
			  }
			  money = money.toString(); 
			  if (money.indexOf(".") == -1) {
			    IntegerNum = money;
			    DecimalNum = '';
			  } else {
			    parts = money.split(".");
			    IntegerNum = parts[0];
			    DecimalNum = parts[1].substr(0, 4);
			  }
			  if (parseInt(IntegerNum, 10) > 0) { 
			    var zeroCount = 0;
			    var IntLen = IntegerNum.length;
			    for (var index = 0; index < IntLen; index++) {
			      var n = IntegerNum.substr(index, 1);
			      var p = IntLen - index - 1;
			      var q = p / 4;
			      var m = p % 4;
			      if (n == "0") {
			        zeroCount++;
			      } else {
			        if (zeroCount > 0) {
			          ChineseStr += cnNums[0];
			        }
			        //归零
			        zeroCount = 0; 
			        ChineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
			      }
			      if (m == 0 && zeroCount < 4) {
			        ChineseStr += cnIntUnits[q];
			      }
			    }
			    ChineseStr += cnIntLast;
			  }
			  if (DecimalNum != '') { 
			    var decLen = DecimalNum.length;
			    for (var index = 0; index < decLen; index++) {
			      var n = DecimalNum.substr(index, 1);
			      if (n != '0') {
			        ChineseStr += cnNums[Number(n)] + cnDecUnits[index];
			      }
			    }
			  }
			  if (ChineseStr == '') {
			    ChineseStr += cnNums[0] + cnIntLast + cnInteger;
			  } else if (DecimalNum == '') {
			    ChineseStr += cnInteger;
			  }
			  return ChineseStr;
		}
 	</script>   
</@htmlBodyScript>